package com.sinodata.bsm.center.service.config;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.sinodata.bsm.center.dao.BaseDao;
import com.sinodata.bsm.common.vo.AppresTopoRel;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author wangpeng
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2013-5-28 上午10:42:15          wangpeng        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */

@Service
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public class APPService {
    @Autowired
    private BaseDao baseDao;

    @Transactional(propagation = Propagation.REQUIRED)
    public void save(AppresTopoRel entity) {
        baseDao.save(entity);
    }

    @SuppressWarnings("unchecked")
    public List<AppresTopoRel> getAllAppresTopoRel() {
        return (List<AppresTopoRel>) baseDao.findAll(AppresTopoRel.class);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public void delete(Long appresTopoRelId) {
        AppresTopoRel rel = (AppresTopoRel) baseDao.findById(AppresTopoRel.class, appresTopoRelId);
        if (rel != null)
            baseDao.delete(rel);
    }
}
